package com.carrental.search.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import javax.annotation.PostConstruct;

/**
 * Elasticsearch降级配置类
 * 当Elasticsearch不可用时使用
 */
@Slf4j
@Configuration
@ConditionalOnProperty(name = "spring.elasticsearch.repositories.enabled", havingValue = "false")
@Import(ElasticsearchMockConfig.class)
public class ElasticsearchFallbackConfig {

    @PostConstruct
    public void init() {
        log.warn("Elasticsearch未启用，使用降级配置");
    }
} 